library(foreign) # Load foreign package
library(ggplot2)
library(dplyr)
library(dotwhisker)
library(gridExtra)
library(tidyr)
library(estimatr)
library(forcats)
library(plyr)
library(tidyverse)
library(lmtest)
library(compareGroups)


# Figure 3: Likelihood of Approving Nuclear use (Among Never-Evers)

setwd("/Users/dmin/Dropbox/Replication_Data/Paper_3/")

Dat <- read.csv("Paper_3_Data_Clean.csv", stringsAsFactors = FALSE)


regNeverEver2 <- lm_robust((Nuclear) ~ as.factor(Treatment) , data=subset(Dat, NuclearTheory==1))
summary(regNeverEver2)


regNeverEverTidy2<-tidy(regNeverEver2)

regNeverEverTidy2 <- regNeverEverTidy2[-c(1),]

regNeverEverLabels2<-c("Peer Moral", "Peer Utilitarian", "Elite Moral", "Elite Utilitarian")

g <- ggplot(data=regNeverEverTidy2, aes(x=term, y=(estimate), color=term, shape=term)) +
  geom_point(size=4) + theme_bw() + geom_errorbar(aes(ymin=(conf.low),ymax=(conf.high)),width=.3) + 
  ggtitle(label=c(""))+ geom_hline(yintercept=0, linetype="dotted")+
  coord_cartesian(ylim=c(-.3,.3)) + 
  scale_x_discrete("Treatment",labels=regNeverEverLabels2) +
  ylab("Average Treatment Effect Estimate") + 
  scale_color_manual("Pro-Nuclear Cue",labels=regNeverEverLabels2, values=c("pink3","red3","cyan3","blue3")) +
  theme(legend.position = "none")

g

ggsave("Image_3.png", plot=g, width=2000, height=2000, units=c("px"))

